<?php
/**
 * Copyright © 2013-2017 Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

// @codingStandardsIgnoreFile

/** @var $block \Magento\Backend\Block\Widget\Form\Container */
 ?>
<?php /* @escapeNotVerified */ echo $block->getFormInitScripts() ?>
<?php if ($block->getButtonsHtml('header')): ?>
    <div class="page-form-actions" <?php /* @escapeNotVerified */ echo $block->getUiId('content-header') ?>><?php echo $block->getButtonsHtml('header') ?></div>
<?php endif; ?>
<?php echo $block->getFormHtml() ?>
<?php if ($block->hasFooterButtons()): ?>
    <div class="content-footer">
        <p class="form-buttons"><?php echo $block->getButtonsHtml('footer') ?></p>
    </div>
<?php endif; ?>
<script>
require([
    'jquery',
    'mage/backend/form',
    'mage/backend/validation'
], function($){

    $('#edit_form').form()
        .validation({
            validationUrl: '<?php /* @escapeNotVerified */ echo $block->getValidationUrl() ?>',
            highlight: function(element) {
                var detailsElement = $(element).closest('details');
                if (detailsElement.length && detailsElement.is('.details')) {
                    var summaryElement = detailsElement.find('summary');
                    if (summaryElement.length && summaryElement.attr('aria-expanded') === "false") {
                        summaryElement.trigger('click');
                    }
                }
                $(element).trigger('highlight.validate');
            }
        });

});
</script>
<?php /* @escapeNotVerified */ echo $block->getFormScripts() ?>
